<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            margin: 0;
            padding: 0;
        }

        /* bottom advertisement */
        .else-container {
            width: 100%;
            height: 100vh;
            position: fixed;
            overflow: hidden;
        }

        .adv-bottom {
            width: 13vw;
            position: absolute;
            right: 0;
            bottom: -8vw;
        }

        .adv-bottom img {
            width: 100%;
        }

        .adv-bottom button {
            position: absolute;
            top: 0;
            right: 0;
        }

        /* content */
        .banner {
            height: 300%;
            width: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .banner>div {
            width: 60vw;
            height: 100vh;
        }

        .banner .box1 {
            background-color: skyblue;
        }

        .banner .box2 {
            background-color: lightgreen;
        }

        .banner .box3 {
            background-color: lightcoral;
        }

        /* symmetrical advertising */
        .adv-double>div {
            width: 8vw;
            position: fixed;
            top: 5vh;
        }

        .adv-double img {
            width: 100%;
        }

        .adv-left {
            left: 2vw;
        }

        .adv-right {
            right: 2vw;
        }

        .adv-double button {
            position: absolute;
            font-size: 1vw;
        }
    </style>
</head>

<body>
    <!-- bottom advertisement -->
    <div class="else-container">
        <div class="adv-bottom">
            <button>X</button>
            <img src="advertisement2.png" alt="">
        </div>
    </div>
    <!-- content              219970142张予菲-->
    <div class="banner">
        <div class="box1"></div>
        <div class="box2"></div>
        <div class="box3"></div>
    </div>
    <!-- symmetrical advertising -->
    <div class="adv-double">
        <div class="adv-left">
            <button>×</button>
            <img src="advertisement1.png" alt="">
        </div>
        <div class="adv-right">
            <button>×</button>
            <img src="advertisement1.png" alt="">
        </div>
    </div>

    <script>
        // getting elements
        const closeDouble = document.querySelectorAll('.adv-double button');
        const advDouble = document.querySelector('.adv-double');
        const closeBottom = document.querySelector('.adv-bottom button');
        const advBottom = document.querySelector('.adv-bottom');

        // position of bottom advertisement
        let bottom = -8;

        let timer = setInterval(() => {
            // reaching the designated position, clear the timer
            if (bottom >= 0) {
                clearInterval(timer);
            } else {
                // move 0.1 position up each time
                bottom += 0.1;
                advBottom.style.bottom = `${bottom}vw`;
            }
        }, 30)

        // click to close double advertisements
        closeDouble.forEach(btn => {
            btn.addEventListener('click', () => {
                advDouble.style.display = 'none';
            })
        })

        // click to close bottom advertisement
        closeBottom.addEventListener('click', () => {
            advBottom.style.display = 'none';
        })
    </script>
</body>

</html>